/**   
 * Copyright © 2018 金风科技. All rights reserved.
 * 
 * @Title: ResponseCodeUtil.java 
 * @Prject: svm-c-common
 * @Package: com.goldwind.svm.common.util 
 * @Description: 通用返回码工具类
 * @author: liangwenlu   
 * @date: 2019年3月25日 
 * @version: V1.0   
 */
package com.gd.iot.energy.util;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

import java.io.IOException;
import java.util.Properties;

/**
 * @ClassName: ResponseCodeUtil
 * @Description: 通用返回码工具类
 */
@Slf4j
public class ResponseCodeUtil {


	private static final String PATH = "/i18n/messages.properties";

	public static final Resource RESOURCE = new ClassPathResource(PATH);

	protected static Properties props = null;

	static {
		try {
			props = PropertiesLoaderUtils.loadProperties(RESOURCE);
		} catch (IOException e) {
			log.error(e.getMessage(), e);
		}
	}

	protected ResponseCodeUtil() {

	}

	/**
	 * 获取指定返回码的解释
	 * @param key code
	 * @return String
	 */
	public static String getProperty(String key) {
		return props.getProperty(key);
	}
}
